var uri = 'http://www.baidu.com/huh value.htm#start'
// http://www.baidu.com/huh%20value.htm#start
console.log(encodeURI(uri))
// http%3A%2F%2Fwww.baidu.com%2Fhuh%20value.htm%23start
console.log(encodeURIComponent(uri))
var deUri1 = 'http%3A%2F%2Fwww.baidu.com%2Fhuh%20value.htm%23start'
var deUri2 = 'http://www.baidu.com/huh%20value.htm#start'
// http://www.baidu.com/huh value.htm#start
console.log(decodeURI(deUri2))
// http://www.baidu.com/huh value.htm#start
console.log(decodeURIComponent(deUri1))

eval("console.log('eval')") // eval

var color = 'red'
function sayColor () {
  console.log(window.color)
}
window.sayColor() // red

var max = Math.max(2, 4, 5, 9, 3)

console.log(max) // 9
var min = Math.min(2, 4, 5, 9, 3)
console.log(min) // 2

var arr = [1, 3, 4, 5, 6, 7]
var ma = Math.max.apply(Math, arr)
Math.max(...arr)
Math.min(...arr)
console.log(ma) // 7

console.log(Math.ceil(25.9)) // 26
console.log(Math.floor(25.9)) // 25
console.log(Math.round(25.9)) // 26

console.log(Math.ceil(25.5)) // 26
console.log(Math.floor(25.5)) // 25
console.log(Math.round(25.5)) // 26

console.log(Math.ceil(25.1)) // 26
console.log(Math.floor(25.1)) // 25
console.log(Math.round(25.1)) // 25

function selectFrom (lowerValue, upperValue) {
  var choices = upperValue - lowerValue + 1 // 可能值的总数，差值 + 1为可能值的总数
  return Math.floor(Math.random() * choices + lowerValue)
}
var num = selectFrom(2, 10)
console.log(num) // 2到10之间的随机数
